package com.wa.controller;
import cn.hutool.core.lang.Console;
import cn.hutool.core.lang.Dict;
import com.wa.nashorn.RawTransferNashornScript;
import com.wa.nashorn.ScriptEngineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.LinkedTransferQueue;

@Slf4j
@RestController
public class HelloController {

    @Autowired
    private ScriptEngineService engineService;

    @RequestMapping("/hello")
    public String handle01(@RequestParam("name") String name){
        log.info("请求进来了....");
        LinkedTransferQueue<Object> transferQueue = new LinkedTransferQueue<>();
        //湘Q54321
        Object[] param = {Dict.create().set("id", 90), name};
        engineService.push(new RawTransferNashornScript(transferQueue,"testxx", param,"parkingCardTypeByPlate",script));
        Object var = engineService.poll(transferQueue);
        Console.log(var);
        return "Hello, Spring Boot 2!"+"你好："+name;
    }


    static String script = "/**\n" +
            " * 中海科拓停车\n" +
            " * 月卡充值\n" +
            " * 引入依赖\n" +
            " */\n" +
            "var log = require(\"log\");\n" +
            "var fetch = require(\"fetch\");\n" +
            "var md5 = require(\"lib/md5\");\n" +
            "\n" +
            "/**\n" +
            " * 停车业务相关\n" +
            " */\n" +
            "var apiService = require(\"apiService\");\n" +
            "var parkingService = apiService.get(\"parkingService\");\n" +
            "\n" +
            "/**\n" +
            " * 业务http请求相关\n" +
            " * @type {string}\n" +
            " */\n" +
            "var HTTP_URL_HOST = 'http://kp-open.keytop.cn/unite-api';\n" +
            "var API_FREE_SPACE = '/api/wec/GetFreeSpaceNum';\n" +
            "var API_CARD_INFO = '/api/wec/GetCarCardInfo';\n" +
            "var API_CARD_Add = '/api/wec/AddCarCardNo';\n" +
            "var API_CARD_RECHARGE_URL = '/api/wec/PayCarCardFee';\n" +
            "//注销月卡//////////////////////////////////////////////////////////////////////\n" +
            "var API_CARD_MODIFY_STATUS = '/api/wec/ModifyCardStatus';\n" +
            "\n" +
            "\n" +
            "var appId = '11263';\n" +
            "var secret = 'c691bad032494999bdef6fe7c17d7945';\n" +
            "var version = '1.0.0';\n" +
            "var accept_language = 'zh-CN';\n" +
            "\n" +
            "var parkingLotId = \"90\";\n" +
            "var parkId = '1785';\n" +
            "var parkUserId = '90';\n" +
            "var parkUserName = '中海项目';\n" +
            "\n" +
            "\n" +
            "function getMd5(str) {\n" +
            "    log.info('zh kt getMd5 str = ', str);\n" +
            "    var hash = md5.create();\n" +
            "    hash.update(str);\n" +
            "    var hex = hash.hex().toUpperCase();\n" +
            "    log.info('zh kt getMd5 hex = ', hex);\n" +
            "    return hex;\n" +
            "}\n" +
            "\n" +
            "\n" +
            "function bodykey(body, secret) {\n" +
            "    var ordered = sortObject(body);\n" +
            "    var signTemp = jsonToQueryString(ordered) + '&' + secret;\n" +
            "    log.info('zh kt origin md5 url = ', signTemp);\n" +
            "    body.key = parkingService.md5Hex(signTemp).toUpperCase();\n" +
            "    body.appId = appId;\n" +
            "    return body;\n" +
            "}\n" +
            "\n" +
            "function sortObject(obj) {\n" +
            "    return Object.keys(obj).sort().reduce(function (result, key) {\n" +
            "        result[key] = obj[key];\n" +
            "        return result;\n" +
            "    }, {});\n" +
            "}\n" +
            "\n" +
            "function jsonToQueryString(json) {\n" +
            "    return Object.keys(json).map(function (key) {\n" +
            "        return key + '=' + json[key];\n" +
            "    }).join('&');\n" +
            "}\n" +
            "\n" +
            "// 日期相关\n" +
            "\n" +
            "//JS判断闰年代码\n" +
            "function isLeapYear(year) {\n" +
            "    return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n" +
            "}\n" +
            "\n" +
            "// 获取每个月最大天数\n" +
            "function getMonthMaxDay(date) {\n" +
            "    var month = date.getMonth() + 1;\n" +
            "    switch (month) {\n" +
            "        case 4:\n" +
            "        case 6:\n" +
            "        case 9:\n" +
            "        case 11:\n" +
            "            return 30;\n" +
            "        case 2:\n" +
            "            if (isLeapYear(date.getFullYear())) {\n" +
            "                return 29;\n" +
            "            }\n" +
            "            return 28;\n" +
            "        default:\n" +
            "            return 31;\n" +
            "    }\n" +
            "}\n" +
            "\n" +
            "function getTimestampByAddMonth(timestamp, monthCount) {\n" +
            "    var date = new Date(timestamp);\n" +
            "    //结束日期为00:00:00 或者 23:59:59\n" +
            "    date.setTime(date.getTime() + 1000);\n" +
            "    var day = date.getDate() - 1;\n" +
            "    //加上月份数\n" +
            "    date.setMonth(date.getMonth() + monthCount, 1);\n" +
            "    var maxDay = getMonthMaxDay(date);\n" +
            "    if (day > maxDay) {\n" +
            "        day = maxDay\n" +
            "    }\n" +
            "    date.setDate(day);\n" +
            "\n" +
            "    //设置下结束时间\n" +
            "    date.setHours(23);\n" +
            "    date.setMinutes(59);\n" +
            "    date.setSeconds(59);\n" +
            "    date.setMilliseconds(59);\n" +
            "    return date.getTime();\n" +
            "}\n" +
            "\n" +
            "function dayEnd(dateStr) {\n" +
            "    var date = new Date(dateStr);\n" +
            "    date.setHours(23);\n" +
            "    date.setMinutes(59);\n" +
            "    date.setSeconds(59);\n" +
            "    date.setMilliseconds(59);\n" +
            "    return date;\n" +
            "}\n" +
            "\n" +
            "\n" +
            "function dayTimestampEnd(timestamp) {\n" +
            "    var date = new Date(timestamp);\n" +
            "    date.setHours(23);\n" +
            "    date.setMinutes(59);\n" +
            "    date.setSeconds(59);\n" +
            "    date.setMilliseconds(59);\n" +
            "    return date.getTime();\n" +
            "}\n" +
            "\n" +
            "\n" +
            "\n" +
            "\n" +
            "//将时间戳转换为日期时间格式“yyyy-MM-dd HH:MM:SS”\n" +
            "// 日期\n" +
            "var PATTERN_DATE_TIME = 'yyyy-MM-dd HH:mm:ss';\n" +
            "\n" +
            "//日期格式化\n" +
            "Date.prototype.format = function (format) {\n" +
            "    var o = {\n" +
            "        \"M+\": this.getMonth() + 1, // month\n" +
            "        \"d+\": this.getDate(), // day\n" +
            "        \"H+\": this.getHours(), // hour\n" +
            "        \"m+\": this.getMinutes(), // minute\n" +
            "        \"s+\": this.getSeconds(), // second\n" +
            "        \"q+\": Math.floor((this.getMonth() + 3) / 3), // quarter\n" +
            "        \"S\": this.getMilliseconds()\n" +
            "        // millisecond\n" +
            "    }\n" +
            "\n" +
            "    if (/(y+)/.test(format))\n" +
            "        format = format.replace(RegExp.$1, (this.getFullYear() + \"\").substr(4 - RegExp.$1.length));\n" +
            "    for (var k in o)\n" +
            "        if (new RegExp(\"(\" + k + \")\").test(format))\n" +
            "            format = format.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : (\"00\" + o[k]).substr((\"\" + o[k]).length));\n" +
            "    return format;\n" +
            "}\n" +
            "\n" +
            "// 日期相关\n" +
            "\n" +
            "\n" +
            "/**\n" +
            " * http请求\n" +
            " */\n" +
            "function post(url, data) {\n" +
            "    log.info('zh kt http post url = ', url, ', data = ', data);\n" +
            "    var response = {};\n" +
            "    fetch(url, data, function (result) {\n" +
            "        // 返回值\n" +
            "        var body = new java.lang.String(result.getBody());\n" +
            "        log.info('zh kt http response = ', body);\n" +
            "        response = JSON.parse(body);\n" +
            "    }, function (reason) {\n" +
            "        log.error('zh kt http error reason = ', reason);\n" +
            "    });\n" +
            "\n" +
            "    return response;\n" +
            "}\n" +
            "\n" +
            "var App = {};\n" +
            "\n" +
            "/**\n" +
            " * 获取月卡信息\n" +
            " * 此接口是与左邻后台交互的接口，必须有\n" +
            " */\n" +
            "App.parkingCardTypeByPlate = function (parkingLot, plateNumber) {\n" +
            "    /**\n" +
            "     * 写下跟停车系统交互数据逻辑，获取月卡信息，返回result\n" +
            "     * 返回值dto包含以下字段\n" +
            "     * parkingLotId:停车场id\n" +
            "     * ownerId:--\n" +
            "     * ownerType:--\n" +
            "     * plateNumber:车牌\n" +
            "     * endTime:月卡到期时间\n" +
            "     * cardType:月卡类型\n" +
            "     * cardTypeId:月卡类型id\n" +
            "     * plateOwnerName：月卡拥有人姓名\n" +
            "     * status:月卡状态\n" +
            "     */\n" +
            "    log.info(parkingLot.id, plateNumber);\n" +
            "    var cardList = listParkingCardsByPlate(parkingLot, plateNumber);\n" +
            "    return JSON.stringify(cardList);\n" +
            "    };\n" +
            "\n" +
            "function listParkingCardsByPlate(parkingLot, plateNumber) {\n" +
            "    var resultList = [];\n" +
            "    log.info(\"listParkingCardsByPlate\", parkingLot.id, plateNumber);\n" +
            "    var cardInfo = getCardInfo(plateNumber);\n" +
            "    log.info(\"cardInfo\", cardInfo);\n" +
            "    if (cardInfo) {\n" +
            "        var expiredTime = new Date(cardInfo.endTime).getTime();\n" +
            "        //新增字段：有效开始时间/////////////////////////////////////////////////////\n" +
            "        var beginTime = new Date(cardInfo.startTime).getTime();\n" +
            "        resultList.push({\n" +
            "            'parkingLotId': parkingLot.id,\n" +
            "            'ownerId': parkingLot.ownerId,\n" +
            "            'ownerType': parkingLot.ownerType,\n" +
            "            'plateNumber': cardInfo.plateNo,\n" +
            "            'endTime': expiredTime,\n" +
            "            'cardType': cardInfo.cardTypeName,\n" +
            "            'cardTypeId': cardInfo.cardTypeId,\n" +
            "            'plateOwnerName': cardInfo.personName,\n" +
            "            'cardStatus': cardInfo.status,\n" +
            "            //添加字段 state: 卡片状态：1：启用，2：注销， 0：全部默认是1（只支持6X）;\n" +
            "            'state': cardInfo.state,\n" +
            "            //添加字段  validValue: 卡内余额(充值车：分，计次车：次,充时车:分钟)\n" +
            "            'validValue': cardInfo.validValue,\n" +
            "            //月卡管理：添加字段：有效起始时间///////////////////////////////////////////////////////\n" +
            "            'startTime': beginTime,\n" +
            "            //月卡管理 添加字段 cardId/////////////////////////////////////////////////////////////\n" +
            "            'cardId': cardInfo.otherCardId\n" +
            "        });\n" +
            "    }\n" +
            "    log.info(\"resultList######\", resultList);\n" +
            "    return resultList;\n" +
            "}\n" +
            "\n" +
            "/*function listParkingCardsByPlate(parkingLot, plateNumber) {\n" +
            "    var resultList = [];\n" +
            "    log.info(\"listParkingCardsByPlate\", parkingLot.id, plateNumber);\n" +
            "\n" +
            "    // 伪造的月卡信息\n" +
            "    var cardInfo = {\n" +
            "        'plateNo': plateNumber,\n" +
            "        'endTime': new Date().getTime() + 30 * 24 * 60 * 60 * 1000,  // 当前时间后的30天\n" +
            "        'cardTypeName': '月卡车',\n" +
            "        'cardTypeId': '9998',\n" +
            "        'personName': '张七',\n" +
            "        'status': 1\n" +
            "    };\n" +
            "\n" +
            "    log.info(cardInfo);\n" +
            "\n" +
            "    var expiredTime = new Date(cardInfo.endTime).getTime();\n" +
            "    resultList.push({\n" +
            "        'parkingLotId': parkingLot.id,\n" +
            "        'ownerId': parkingLot.ownerId,\n" +
            "        'ownerType': parkingLot.ownerType,\n" +
            "        'plateNumber': cardInfo.plateNo,\n" +
            "        'endTime': expiredTime,\n" +
            "        'cardType': cardInfo.cardTypeName,\n" +
            "        'cardTypeId': cardInfo.cardTypeId,\n" +
            "        'plateOwnerName': cardInfo.personName,\n" +
            "        'cardStatus': cardInfo.status\n" +
            "    });\n" +
            "    return resultList;\n" +
            "}*/\n" +
            "\n" +
            "/**\n" +
            " * 获取月卡类型\n" +
            " * 此接口是与左邻后台交互的接口，必须有\n" +
            " * @param cmd\n" +
            " * @returns {string}\n" +
            " */\n" +
            "App.parkingCardType = function (cmd) {\n" +
            "    /**\n" +
            "     * 写下跟停车系统交互数据逻辑，获取月卡类型，返回result\n" +
            "     * 返回值dto包含以下字段\n" +
            "     * typeId:月卡类型id\n" +
            "     * typeName:月卡类型名称\n" +
            "     */\n" +
            "    log.info('月卡充值 cmd = ', cmd);\n" +
            "    return JSON.stringify(getCardType());\n" +
            "};\n" +
            "\n" +
            "//获取月卡类型\n" +
            "function getCardType() {\n" +
            "    return [\n" +
            "        {\"typeId\": \"2\", \"typeName\": \"月卡车\"}\n" +
            "    ];\n" +
            "}\n" +
            "\n" +
            "/**\n" +
            " * 通知停车场缴费结果\n" +
            " * 此接口是与左邻后台交互的接口，必须有\n" +
            " */\n" +
            "App.parkingNotifyRecharge = function (order) {\n" +
            "    log.info('月卡充值 order=', order);\n" +
            "    /**\n" +
            "     * 写下跟停车系统交互数据逻辑，通知停车系统该车已经缴费成功，返回result\n" +
            "     * 返回值，成功则返回'true'字符串，失败则返回'false'字符串。\n" +
            "     */\n" +
            "    if (order.orderType === 1 && order.rechargeType === 1) {\n" +
            "        //月卡充值\n" +
            "        return rechargeMonthlyCard(order);\n" +
            "    }\n" +
            "    return 'false';\n" +
            "};\n" +
            "\n" +
            "/**\n" +
            " * 注销恢复月卡\n" +
            " * 此接口是与左邻后台交互的接口/////////////////////////////////////////////////////////\n" +
            " */\n" +
            "App.modifyCardStatus = function (cmd) {\n" +
            "    log.info('月卡恢复注销 cmd = ', cmd);\n" +
            "    var params = JSON.parse(cmd);\n" +
            "    log.info('月卡恢复注销 params = ', params);\n" +
            "    var cardId = params.cardId;\n" +
            "    var flag = params.flag;\n" +
            "    var result = modifyCardStatus(cardId, flag);\n" +
            "    return result;\n" +
            "}\n" +
            "\n" +
            "//注销恢复月卡结果通知/////////////////////////////////////////////////////////////\n" +
            "function modifyCardStatus(cardId, flag) {\n" +
            "    log.info(\"cardId=\", cardId);\n" +
            "    log.info(\"flag=\", flag);\n" +
            "    var url = HTTP_URL_HOST + API_CARD_MODIFY_STATUS;\n" +
            "\n" +
            "    var headers = {\n" +
            "        'version': version,\n" +
            "        'accept-language': accept_language,\n" +
            "        'Content-Type': 'application/json;charset=UTF-8'\n" +
            "    };\n" +
            "\n" +
            "    var ts = new Date().getTime();\n" +
            "    var reqId = ts + \"_\" + Math.floor(Math.random() * 100);\n" +
            "\n" +
            "    var body = {\n" +
            "\n" +
            "        parkId: parkId,\n" +
            "        serviceCode: 'modifyCardStatus',\n" +
            "        ts: ts,\n" +
            "        reqId: reqId,\n" +
            "        cardId: cardId,\n" +
            "        flag: flag\n" +
            "    };\n" +
            "    body = bodykey(body, secret);\n" +
            "\n" +
            "    var data = {method: 'POST', headers: headers, param: body};\n" +
            "    var response = post(url, data);\n" +
            "    log.info('response.data=', response.data);\n" +
            "    if (response.resCode === \"0\") {\n" +
            "        return \"true\"; // 操作成功\n" +
            "    } else {\n" +
            "        return \"false\"; // 操作失败\n" +
            "    }\n" +
            "}\n" +
            "\n" +
            "\n" +
            "//月卡充值结果通知\n" +
            "function rechargeMonthlyCard(order) {\n" +
            "    //获取月卡信息\n" +
            "    var card = getCardInfo(order.plateNumber);\n" +
            "    if (card) {\n" +
            "        var url = HTTP_URL_HOST + API_CARD_RECHARGE_URL;\n" +
            "\n" +
            "        var headers = {\n" +
            "            'version': version,\n" +
            "            'accept-language': accept_language,\n" +
            "            'Content-Type': 'application/json;charset=UTF-8'\n" +
            "        };\n" +
            "\n" +
            "        var ts = new Date().getTime();\n" +
            "        var reqId = ts + \"_\" + Math.floor(Math.random() * 100);\n" +
            "\n" +
            "        var payType;\n" +
            "        if (order.paidType === '10002') { //微信\n" +
            "            payType = 4;\n" +
            "        } else if (order.paidType === '10001') { //支付宝\n" +
            "            payType = 5;\n" +
            "        } else {\n" +
            "            payType = 7; // 其他\n" +
            "        }\n" +
            "\n" +
            "        var startDate = new Date(card.endTime);\n" +
            "        var startTime = startDate.getTime();\n" +
            "\n" +
            "        var date = new Date();\n" +
            "        date.setHours(0);\n" +
            "        date.setMinutes(0);\n" +
            "        date.setSeconds(0);\n" +
            "        var now = date.getTime();\n" +
            "\n" +
            "        // startTime 为上次月卡结束时间如果当前时间比结束时间早，需加一天\n" +
            "        if (now > startTime) {\n" +
            "            startTime = now;\n" +
            "        }\n" +
            "        var endTimeStamp = getTimestampByAddMonth(Number(startTime), parseInt(order.monthCount));\n" +
            "        var newEndTime = new Date(endTimeStamp).format(PATTERN_DATE_TIME);\n" +
            "\n" +
            "        // 科拓，要求起始时间必须是 00：00：00\n" +
            "        var newStartDate = new Date(startTime + 1000);\n" +
            "        newStartDate.setHours(0);\n" +
            "        newStartDate.setMinutes(0);\n" +
            "        newStartDate.setSeconds(0);\n" +
            "        newStartDate.setMilliseconds(0);\n" +
            "        var newStartTime = newStartDate.format(PATTERN_DATE_TIME);\n" +
            "\n" +
            "        var createTimeStr = new Date().format(PATTERN_DATE_TIME);\n" +
            "\n" +
            "        var body = {\n" +
            "            parkId: parkId,\n" +
            "            serviceCode: 'payCarCardFee',\n" +
            "            ts: ts,\n" +
            "            reqId: reqId,\n" +
            "\n" +
            "            userId: parkUserId,\n" +
            "            userName: parkUserName,\n" +
            "            // 对接方的月卡id\n" +
            "            cardId: card.otherCardId,\n" +
            "            orderNo:order.bizOrderNo,\n" +
            "            carType:2,\n" +
            "            payChannel:payType,\n" +
            "            chargeMethod:1,\n" +
            "            chargeNumber:parseInt(order.monthCount),\n" +
            "            // 单位是分\n" +
            "            amount: parseInt(order.price * 100),\n" +
            "            freeNumber:'0',\n" +
            "            validFrom: newStartTime,\n" +
            "            validTo: newEndTime,\n" +
            "            createTime: createTimeStr,\n" +
            "            remark:'月卡车充值'\n" +
            "        }\n" +
            "        body = bodykey(body, secret);\n" +
            "\n" +
            "        var data = {method: 'POST', headers: headers, param: body};\n" +
            "        var response = post(url, data);\n" +
            "        log.info('response.data=', response.data);\n" +
            "        // 成功返回\n" +
            "        // {\"data\":\"{\\\"ischeck\\\":1,\\\"orderNo\\\":\\\"PARK0000120230224\\\"}\",\"resCode\":\"0\",\"resMsg\":\"成功\"}\n" +
            "        if (response.resCode === '0') {\n" +
            "            parkingService.updateParkingRechargeOrderTime(order, newStartTime, newEndTime);\n" +
            "            return 'true';\n" +
            "        }\n" +
            "    }\n" +
            "    return 'false';\n" +
            "}\n" +
            "\n" +
            "function getCardInfo(plateNo) {\n" +
            "    log.info(\"getCardInfo plateNo=\", plateNo);\n" +
            "    var url = HTTP_URL_HOST + API_CARD_INFO;\n" +
            "\n" +
            "    var headers = {\n" +
            "        'version': version,\n" +
            "        'accept-language': accept_language,\n" +
            "        'Content-Type': 'application/json;charset=UTF-8'\n" +
            "    };\n" +
            "\n" +
            "    var ts = new Date().getTime();\n" +
            "    var reqId = ts + \"_\" + Math.floor(Math.random() * 100);\n" +
            "\n" +
            "    var body = {\n" +
            "\n" +
            "        parkId: parkId,\n" +
            "        serviceCode: 'getCarCardInfo',\n" +
            "        ts: ts,\n" +
            "        reqId: reqId,\n" +
            "\n" +
            "        plateNo: plateNo\n" +
            "    };\n" +
            "    body = bodykey(body, secret);\n" +
            "\n" +
            "    var data = {method: 'POST', headers: headers, param: body};\n" +
            "    var response = post(url, data);\n" +
            "    log.info('response.data=', response.data);\n" +
            "    if (response.resCode === '0' && response.data != '') {\n" +
            "        // 有月卡的情况\n" +
            "        var redata = JSON.parse(response.data);\n" +
            "        log.info('redata====',redata);\n" +
            "        // 月卡车牌信息\n" +
            "        var plateNoInfo = JSON.parse(redata.plateNoInfo);\n" +
            "        log.info('plateNoInfo====', plateNoInfo);\n" +
            "        // 月卡车信息\n" +
            "        var carLotList = JSON.parse(redata.carLotList);\n" +
            "        log.info('carLotList====', carLotList);\n" +
            "\n" +
            "\n" +
            "        var expireDate = dayEnd(carLotList[0].endTime);\n" +
            "        //新增字段加有效开始时间//////////////////////////////////////////////////////\n" +
            "        var beginDate = dayEnd(carLotList[0].beginTime);\n" +
            "        log.info(\"getCardInfo expireDate=\", expireDate.format(PATTERN_DATE_TIME));\n" +
            "        log.info(\"getCardInfo startDate=\", beginDate.format(PATTERN_DATE_TIME));\n" +
            "        return {\n" +
            "            // 没错，第三方就是用 useName 表示 户主名\n" +
            "            personName: redata.useName,\n" +
            "            personPhone: redata.tel,\n" +
            "            plateNo: plateNoInfo[0].plateNo,\n" +
            "            expireDate: expireDate.format(PATTERN_DATE_TIME),\n" +
            "            endTime: expireDate.getTime(),\n" +
            "            cardTypeId: ''+carLotList[0].carType,\n" +
            "            cardTypeName: '月卡车',\n" +
            "            status: 1,\n" +
            "            // otherCardId 对接方的月卡id\n" +
            "            otherCardId: redata.cardId,\n" +
            "            //添加字段//////////////////////////////////////////////////\n" +
            "            state: redata.state,\n" +
            "            validValue: carLotList[0].validValue,\n" +
            "            //月卡管理：添加字段：有效起始时间/////////////////////////////////\n" +
            "            beginDate: beginDate.format(PATTERN_DATE_TIME),\n" +
            "            startTime: beginDate.getTime()\n" +
            "        };\n" +
            "    }\n" +
            "    return null;\n" +
            "}\n" +
            "\n" +
            "\n" +
            "App.parkingEndTime = function (startTime, monthCount) {\n" +
            "    log.info('parkingEndTime startTime=', startTime, \",monthCount=\", monthCount);\n" +
            "    var endTime = getTimestampByAddMonth(Number(startTime), monthCount);\n" +
            "    log.info('parkingEndTime: ', endTime);\n" +
            "    return JSON.stringify(endTime);\n" +
            "}\n" +
            "\n" +
            "module.exports = App;";


}
